feat: add pagination to miner PRs and issues endpoints#112
feat: add pagination to miner PRs and issues endpoints#112Kelvinchen03 wants to merge 2 commits into
Conversation
anderdc
left a comment
There was a problem hiding this comment.
Pagination params on existing endpoints — close, but three blockers before this can merge:
-
packages/das/src/api/miners/miners.service.ts — the cursor encodes the lowercased repo_full_name (SELECT aliases LOWER(p.repo_full_name) AS repo_full_name, and next_cursor is built from that alias), but the keyset predicate (p.repo_full_name < $4) and ORDER BY p.repo_full_name DESC compare against the raw column. Mixed-case repo names will skip or duplicate rows at page boundaries. Order and compare on LOWER(p.repo_full_name) consistently, or encode the raw value into the cursor.
-
getPullRequests/getIssues — the bounded default (50 rows) is applied unconditionally. These endpoints are validator-facing and currently return all rows; flipping the default silently truncates what validators score on until they follow next_cursor. Gate the bounding behind MINERS_PAGINATION_ENABLED (default off) as the issue's Backward-compatibility section specifies.
-
Remove the stray package-lock.json — it's empty ({"packages":{}}) and unrelated to this change.
|
Duplicate of #126 which is better scoped/implemented. Closing. |
Summary
Implements cursor-based pagination with hard result caps for the /miners/:githubId/pulls and /miners/:githubId/issues endpoints. Adds cursor and limit query parameters to prevent unbounded responses while maintaining backward compatibility. Results default to 50 per page with a maximum cap of 200.
Related Issues
Closes #100
Type of Change
Testing
Started dev server: npm run dev in d:/Projects/gittensor/das-github-mirror/packages/das
Tested first page: GET /api/v1/miners/:githubId/pulls?limit=10
Checklist